<template>
  <a-modal
    :visible="visible"
    :title="$t('button.audit')"
    :width="900"
    :bodyStyle="{
      height: '500px',
      overflow: 'auto'
    }"
    :okText="$t('button.SubmitReview')"
    @cancel="() => { $emit('cancel') }"
    @ok="confirm"
  >
    <detail-list>
      <detail-list-item :term="$t('key.xh')">{{ detail.xh }}&emsp;</detail-list-item>
      <detail-list-item :term="$t('key.name')">{{ detail.xm }}&emsp;</detail-list-item>
      <detail-list-item :term="$t('key.nj')">{{ detail.sznj }}&emsp;</detail-list-item>
      <detail-list-item :term="$t('key.sqzt')">{{ detail.sqztmc }}&emsp;</detail-list-item>
      <detail-list-item :term="$t('key.yx')">{{ detail.ssyxmc }}&emsp;</detail-list-item>
      <detail-list-item :term="$t('key.zy')">{{ detail.sszymc }}&emsp;</detail-list-item>
      <detail-list-item :term="$t('key.xn')">{{ detail.sznj }}&emsp;</detail-list-item>
      <!-- <detail-list-item :term="$t('key.dsxm')">{{ detail.dsxm }}&emsp;</detail-list-item> -->
      <detail-list-item :term="$t('key.lxfs')">{{ detail.lxfs }}&emsp;</detail-list-item>
      <detail-list-item :term="$t('key.email')">{{ detail.email }}&emsp;</detail-list-item>
    </detail-list>
    
    <a-row >
      <a-col :md="12" :sm="24">
        <a-form :form="form">
          <a-form-item
            :label="$t('key.shzt')"
            :labelCol="{span: 7,offset: 1}"
            :wrapperCol="{span: 15, offset: 1}"
          >
            <a-select v-decorator="['status',
              {
                rules: [{ required: true, message: '请选择导师审核状态!' }],
              }]">
              <a-select-option value="03">通过</a-select-option>
              <a-select-option value="04">不通过</a-select-option>
            </a-select>
          </a-form-item>
          <a-form-item
            :label="$t('key.opinion')"
            :labelCol="{span: 7,offset: 1}"
            :wrapperCol="{span: 15, offset: 1}"
          >
            <a-textarea v-decorator="['opinion',
              {
                rules: [{ required: true, message: '请输入导师审核说明!' }],
              }]" />
          </a-form-item>
        </a-form>
      </a-col>
    </a-row>
  </a-modal>

</template>

<script>
import { mapState } from 'vuex'
import DetailList from '~/tool/DetailList'
const DetailListItem = DetailList.Item

export default {
  props: ['visible'],
  data () {
    return {
      form: this.$form.createForm(this),
      detail: {},
    }
  },
  computed: {
    ...mapState({
      TYPE0341: state => state.app['TYPE0341']
    })
  },
  created () {
    this.$store.dispatch('app/setDictionary', 'TYPE0341')
  },
  methods: {
    confirm () {
      this.form.validateFields((err, values) => {
        if (err) return
        console.log(values)
        let params = {
          ...values,
          id: this.detail.id
        }
        this.$api.overseas.wsCheck(params).then(res => {
          let msg = res.msg ? res.msg : '审核成功！'
          this.$message.success(msg)
          this.$emit('cancel')
          this.$emit('refresh')
        }) 
      })
    }
  },
  components: {
    DetailList,
    DetailListItem
  }
}
</script>
